package com.ssm.dao.mybatis.dept;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.ssm.dto.mybatis.Dept;

public class DeptDAOImpl extends SqlSessionDaoSupport implements IDeptDAO {

	@Override
	public void insertDept(Dept dept) {
		getSqlSession().insert("dept.newDept", dept);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<Dept> query(Dept dept) {
		return getSqlSession().selectList("dept.queryDeptById", dept);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<Dept> queryByName(Dept dept) {
		return getSqlSession().selectList("dept.queryDeptByName", dept,
				new RowBounds(1, 3));
	}

	@Override
	public int deleteAllDept() {
		return getSqlSession().delete("dept.deleteAll");
	}

}
